import {Component} from 'react';

const Seventeen = (WrappedComponent) => {
	return class extends Component {
		render() {
			const props = {
				...this.props,
				name: "这是高阶组件"
			};
			return <WrappedComponent {...props} />;
		}
    };
}

class WrappedComponent extends Component {
	state = {
		baseName:'这是基础组件' 
	}
	render() {
		const {baseName} = this.state
		const {name} = this.props
		return <div>
			<div>基础组件值为{baseName}</div>
			<div>通过高阶组件属性代理的得到的值为{name}</div>
		</div>
	}
}

export default Seventeen(WrappedComponent)
